Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New Colors() class #2963

Merged
merged 1 commit into from
Apr 28, 2021
Merged

New Colors() class #2963

merged 1 commit into from
Apr 28, 2021

Conversation

glenn-jocher
Copy link
Member

@glenn-jocher glenn-jocher commented Apr 28, 2021

@kalenmike @SergioSanchezUltralytics

This PR implements improvements to the YOLOv5 colors by creating a new Colors() class that handles datatype and modulus operations automatically and provides BGR order support. All colors are now centralized and sourced at one location, and detect.py is now brought under the same color palette as the rest of the github repo.

This will also allow for single-point substitution of our own Ultralytics color palette when it's ready.

🛠️ PR Summary

Made with ❤️ by Ultralytics Actions

🌟 Summary

Improved color handling for bounding box visualization in YOLOv5.

📊 Key Changes

  • Refactored color generation into the Colors class within utils/plots.py.
  • Removed redundant color list generation from multiple files (detect.py, models/common.py, and utils/plots.py).
  • Adjusted color usage to call the colors class instance when plotting bounding boxes.

🎯 Purpose & Impact

  • This change centralizes the color management for visual elements, which leads to more consistent use of colors across the project.
  • The impact on users includes more uniform visual outputs and potentially fixing any inconsistent color applications previously present.
  • Developers benefit from a cleaner, DRY (Don't Repeat Yourself) codebase with a single source of truth for color choices.
  • The refactoring may make it easier to maintain and adjust visual styling in the future, as there's now a single place to make changes to the color palette.

@glenn-jocher glenn-jocher self-assigned this Apr 28, 2021
@glenn-jocher glenn-jocher added the enhancement New feature or request label Apr 28, 2021
@glenn-jocher glenn-jocher merged commit 57812df into master Apr 28, 2021
@glenn-jocher glenn-jocher deleted the colors branch April 28, 2021 14:05
KMint1819 pushed a commit to KMint1819/yolov5 that referenced this pull request May 12, 2021
danny-schwartz7 pushed a commit to danny-schwartz7/yolov5 that referenced this pull request May 22, 2021
Lechtr pushed a commit to Lechtr/yolov5 that referenced this pull request Jul 20, 2021
BjarneKuehl pushed a commit to fhkiel-mlaip/yolov5 that referenced this pull request Aug 26, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant